package com.matt.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.matt.commons.model.Domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;

/**
 * *******************************
 * Created by Ron.
 * form com.matt
 * on 2017/7/13
 * *******************************
 */
@Entity
@Data
@Table(name = "children_nursery_info_record")
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class ChildrenNurseryInfoRecord  extends Domain {

    @Id
    @Column(columnDefinition = "varchar(32) COMMENT 'id' ")
    private String id;

    @Column(columnDefinition = "varchar(50) COMMENT '宝宝id' ")
    @ApiModelProperty(value = "宝宝id")
    private String childrenId;

    @Column(columnDefinition = "varchar(32) COMMENT '园区Id' ")
    @ApiModelProperty(value = "园区Id")
    private String areaId;

    @Column(columnDefinition = "varchar(50) COMMENT '宝宝名称 （冗余）' ")
    @ApiModelProperty(value = "宝宝名称")
    private String childrenName;

    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
    @Column(columnDefinition = "datetime default NOW() COMMENT '开始时间'", nullable = false)
    @ApiModelProperty(value = "开始时间")
    private Date beginDate = new Date();

    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
    @Column(columnDefinition = "datetime default NOW() COMMENT '结束时间'", nullable = false)
    @ApiModelProperty(value = "结束时间")
    private Date endDate = new Date();

    @Column(columnDefinition = "int default 4 COMMENT  '状态 0，缺席（未签到），1，入园，2，离园，3，拒绝入园 4-请假' ")
    @ApiModelProperty(value = "状态 0，缺席（未签到），1，入园，2，离园，3，拒绝入园 4-请假")
    private Integer status;

    @Column(columnDefinition = "int default 0 COMMENT '离园状态 2:离园，6早退' ")
    private Integer leaveStatus = 0;
    @Column(columnDefinition = "int default 0 COMMENT  '状态 0健康，1病假（不健康）' ")
    @ApiModelProperty(value = "0健康，1病假（不健康）")
    private Integer healthyStatus;

    @Column(columnDefinition = "int default 0 COMMENT  '类型0普通记录,1延长合同,2入户扣课' ")
    @ApiModelProperty(value = "类型0普通记录,1延长合同,2入户扣课")
    private Integer type;

    @Column(columnDefinition = "int default 1 COMMENT  '影响天数' ")
    @ApiModelProperty(value = "影响天数")
    private Integer effectDay;

    @Column(columnDefinition = "int default 0 COMMENT  '初始剩余延长合同天数' ")
    @ApiModelProperty(value = "初始剩余延长合同天数")
    private Integer surplusOriginalLeaveDay;

    @Column(columnDefinition = "int default 0 COMMENT  '剩余延长合同天数' ")
    @ApiModelProperty(value = "剩余延长合同天数")
    private Integer surplusLeaveDay;

    @Column(columnDefinition = "datetime default NOW() COMMENT '初始合同结束日期' ")
    @ApiModelProperty(value = "初始合同结束日期")
    private Date nurseryOriginalEndDate = new Date();

    @Column(columnDefinition = "datetime default NOW() COMMENT '合同结束日期'")
    @ApiModelProperty(value = "合同结束日期")
    private Date nurseryEndDate = new Date();

    @Column(columnDefinition = "varchar(32)  COMMENT '创建人'")
    @ApiModelProperty(value = "创建人")
    private String createdBy;

    @Column(columnDefinition = "varchar(255)  COMMENT '创建名称'")
    @ApiModelProperty(value = "创建名称")
    private String createdName;

    @Column(columnDefinition = "varchar(32)  COMMENT '备注'")
    @ApiModelProperty(value = "备注")
    private String remark = "";

    @ApiModelProperty(value = "温度")
    private double personTemperature;

//    @Column(columnDefinition = "datetime  COMMENT '打卡时间' ")
//    private Date checkTime;
//
    public static ChildrenNurseryInfoRecord of(String childrenId, String childrenName,String createdBy,String createdName){
        ChildrenNurseryInfoRecord info = new ChildrenNurseryInfoRecord();
        info.setChildrenId(childrenId);
        info.setChildrenName(childrenName);
        info.setCreatedBy(createdBy);
        info.setCreatedName(createdName);
        return info;
    }
}
